package com.example.demo.interceptor;

import java.util.Properties;

import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;


import lombok.Data;
//ExamplePlugin.java
@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
@Data
public class ExamplePlugin implements Interceptor {
	public Object intercept(Invocation invocation) throws Throwable {
		System.out.println("update intercept");
		return invocation.proceed();
	}

	public Object plugin(Object target) {
		System.out.println("update plugin");
		return Plugin.wrap(target, this);
	}

	public void setProperties(Properties properties) {
		System.out.println("update setProperties");
	}
}
